package com.zisu.springcloud.service;

import com.zisu.springcloud.entity.CommonResult;
import com.zisu.springcloud.entity.Payment;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2020/9/4 16:06
 */

//Feign就是 “注解 + 方法” 的形式来调用微服务的，，所以只需要接口的形式 不需要去实现这个接口
@Component
//"CLOUD-PAYMENT-SERVICE" 是微服务的名称，，我们调用的时候 也是以这个名字 为地址的
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentFeignService {

    @GetMapping(value = "/payment/get/{id}")
    public CommonResult<Payment> get(@PathVariable("id") Long id);

    @GetMapping(value = "/payment/feign/timeout")
    public String paymentFeignTimeout();
}
